<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('选择销售订单')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>订单号：</label>
                                <input type="text" name="orderCode"/>
                            </li>
                            <li>
                                <label>客户名称：</label>
                                <input type="text" name="customerName"/>
                            </li>
                            <li>
                                <label>业务责任人：</label>
                                <input type="text" name="businessManager"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "order/saleorder";
        let orderStatusDatas = [[${@dict.getType('order_status')}]];
        let productionStatusDatas = [[${@dict.getType('production_status')}]];
        let deliveryStatusDatas = [[${@dict.getType('delivery_status')}]];

        $(function() {

            var options = {
                url: prefix + "/selectList",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "销售单",
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '客户id',
                    visible: false
                },
                {
                    field: 'orderCode',
                    title: '订单号'
                },
                {
                    field: 'providerName',
                    title: '供方'
                },
                {
                    field: 'customerId',
                    title: '客户ID',
                    visible: false
                },
                {
                    field: 'customerName',
                    title: '客户名称'
                },
                {
                    field: 'businessManager',
                    title: '业务责任人'
                },
                {
                    field: 'orderDate',
                    title: '订单日期'
                },
                {
                    field: 'orderStatus',
                    title: '订单状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderStatusDatas, value);
                    }
                },
                {
                    field: 'produceStatus',
                    title: '生产状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(productionStatusDatas, value);
                    }
                },
                {
                    field: 'deliveryStatus',
                    title: '发货状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(deliveryStatusDatas, value);
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                }
              ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>